package com.axjy.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.axjy.pojo.Manager;
import com.axjy.service.ManagerService;
import com.axjy.util.Pager;
/**
 * 
 *
 *	<p>Title:UserController</p>
 *	<p>Description:</p>
 *	<p>Company:www.axjy.com</p>
 *	@date 		2017年10月11日 下午4:58:36
 *	@author 	yue
 *	@version 	1.0
 */
@Controller
@RequestMapping("/manager")
public class ManagerController {
	
	@Resource
	private ManagerService mg;
	
	@RequestMapping("/list")
	@ResponseBody
	public Pager<Manager> mList(Integer offset,Integer limit){

		Pager<Manager> pager = new Pager<Manager>(); 
		pager.setRows(mg.searchByPager(offset, limit));
		pager.setTotal(mg.getTotalByPager());
		return pager;
	}
	
	@RequestMapping("/delOne")
	@ResponseBody	
	public String delone(Integer mgId) {
		return mg.del(mgId).toString();
	}
	
	@RequestMapping("/edit")
	@ResponseBody
	public String editMG(Manager manager) {
		return mg.update(manager).toString();
	}
	
}
